package com.kotlin.lib.multi.callback

class LocationCallBackImp(var onGetLocation: (String) -> Unit, var onErrorAction: (() -> Unit)? = null) :
    LocationCallBack {
    override fun onCurrentLocation(location: String) {
        onGetLocation(location)
    }

    override fun onError() {
        onErrorAction?.invoke()
    }
}

var callBack: LocationCallBack? = null
fun setListener(listener: LocationCallBack) {
    listener.onCurrentLocation("a")
    listener.onError()
}

fun setListenerImp(listener: LocationCallBackImp.() -> Unit) {

/*    listener.
    listener.onCurrentLocation("B")
    listener.onError()*/
}

fun main() {
    setListenerImp {
        onGetLocation = {
            println("onGetLocation:$it")
        }
        onErrorAction = {

        }
    }
}